package com.prj.ufdm.demo.tutorial.j2se.hashcode;
/**
 * DESC: 产生hash code 的javaBean <br>
 * @author 胡义振
 * @date 2020年3月10日
 */
public class HashObject {

	public String corpName;
	public String address;
	public int longitude;
	public int latitude;
	
	public HashObject(int longitude,int latitude){
		this.longitude = longitude;
		this.latitude = latitude;
	}
	
	/**
	 * DESC: 生成经度、纬度的HashCode
	 * @auther 胡义振
	 * @date 2020年3月10日
	 * @return 
	 * @return
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + latitude;
		result = prime * result + longitude;
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		HashObject other = (HashObject) obj;
		if (latitude != other.latitude)
			return false;
		if (longitude != other.longitude)
			return false;
		return true;
	}
	
	public String getCorpName() {
		return corpName;
	}
	public void setCorpName(String corpName) {
		this.corpName = corpName;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public int getLongitude() {
		return longitude;
	}
	public void setLongitude(int longitude) {
		this.longitude = longitude;
	}
	public int getLatitude() {
		return latitude;
	}
	public void setLatitude(int latitude) {
		this.latitude = latitude;
	}
	
	@Override
	public String toString() {
		return "HashObject [corpName=" + corpName + ", address=" + address + ", longitude=" + longitude + ", latitude="
				+ latitude + "]";
	}
	
	
}
